

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="Description" content="scikit-learn: machine learning in Python">

  
  <title>sklearn.model_selection.RandomizedSearchCV &mdash; scikit-learn 0.22 documentation</title>
  
  <link rel="canonical" href="http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.RandomizedSearchCV.html" />

  
  <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  <link rel="stylesheet" href="../../_static/css/vendor/bootstrap.min.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script> 
</head>
<body>
<nav id="navbar" class="sk-docs-navbar navbar navbar-expand-md navbar-light bg-light py-0">
  <div class="container-fluid sk-docs-container px-0">
      <a class="navbar-brand py-0" href="../../index.html">
        <img
          class="sk-brand-img"
          src="../../_static/scikit-learn-logo-small.png"
          alt="logo"/>
      </a>
    <button
      id="sk-navbar-toggler"
      class="navbar-toggler"
      type="button"
      data-toggle="collapse"
      data-target="#navbarSupportedContent"
      aria-controls="navbarSupportedContent"
      aria-expanded="false"
      aria-label="Toggle navigation"
    >
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="sk-navbar-collapse collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../install.html">Install</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../user_guide.html">User Guide</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../classes.html">API</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../auto_examples/index.html">Examples</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../getting_started.html">Getting Started</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../tutorial/index.html">Tutorial</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../glossary.html">Glossary</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../developers/index.html">Development</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../faq.html">FAQ</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../related_projects.html">Related packages</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../roadmap.html">Roadmap</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../about.html">About us</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://github.com/scikit-learn/scikit-learn">GitHub</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://scikit-learn.org/dev/versions.html">Other Versions</a>
        </li>
        <li class="nav-item dropdown nav-more-item-dropdown">
          <a class="sk-nav-link nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More</a>
          <div class="dropdown-menu" aria-labelledby="navbarDropdown">
              <a class="sk-nav-dropdown-item dropdown-item" href="../../getting_started.html">Getting Started</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../tutorial/index.html">Tutorial</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../glossary.html">Glossary</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../developers/index.html">Development</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../faq.html">FAQ</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../related_projects.html">Related packages</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../roadmap.html">Roadmap</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../about.html">About us</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="https://github.com/scikit-learn/scikit-learn">GitHub</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="https://scikit-learn.org/dev/versions.html">Other Versions</a>
          </div>
        </li>
      </ul>
      <div id="searchbox" role="search">
          <div class="searchformwrapper">
          <form class="search" action="../../search.html" method="get">
            <input class="sk-search-text-input" type="text" name="q" aria-labelledby="searchlabel" />
            <input class="sk-search-text-btn" type="submit" value="Go" />
          </form>
          </div>
      </div>
    </div>
  </div>
</nav>
<div class="d-flex" id="sk-doc-wrapper">
    <input type="checkbox" name="sk-toggle-checkbox" id="sk-toggle-checkbox">
    <label id="sk-sidemenu-toggle" class="sk-btn-toggle-toc btn sk-btn-primary" for="sk-toggle-checkbox">Toggle Menu</label>
    <div id="sk-sidebar-wrapper" class="border-right">
      <div class="sk-sidebar-toc-wrapper">
        <div class="sk-sidebar-toc-logo">
          <a href="../../index.html">
            <img
              class="sk-brand-img"
              src="../../_static/scikit-learn-logo-small.png"
              alt="logo"/>
          </a>
        </div>
        <div class="btn-group w-100 mb-2" role="group" aria-label="rellinks">
            <a href="sklearn.model_selection.ParameterSampler.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.model_selection.ParameterSampler">Prev</a><a href="../classes.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="API Reference">Up</a>
            <a href="sklearn.model_selection.fit_grid_point.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.model_selection.fit_grid_point">Next</a>
        </div>
        <div class="alert alert-danger p-1 mb-2" role="alert">
          <p class="text-center mb-0">
          <strong>scikit-learn 0.22</strong><br/>
          <a href="http://scikit-learn.org/dev/versions.html">Other versions</a>
          </p>
        </div>
        <div class="alert alert-warning p-1 mb-2" role="alert">
          <p class="text-center mb-0">
            Please <a class="font-weight-bold" href="../../about.html#citing-scikit-learn"><string>cite us</string></a> if you use the software.
          </p>
        </div>
          <div class="sk-sidebar-toc">
            <ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.model_selection</span></code>.RandomizedSearchCV</a><ul>
<li><a class="reference internal" href="#examples-using-sklearn-model-selection-randomizedsearchcv">Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.model_selection.RandomizedSearchCV</span></code></a></li>
</ul>
</li>
</ul>

          </div>
      </div>
    </div>
    <div id="sk-page-content-wrapper">
      <div class="sk-page-content container-fluid body px-md-3" role="main">
        
  <div class="section" id="sklearn-model-selection-randomizedsearchcv">
<h1><a class="reference internal" href="../classes.html#module-sklearn.model_selection" title="sklearn.model_selection"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.model_selection</span></code></a>.RandomizedSearchCV<a class="headerlink" href="#sklearn-model-selection-randomizedsearchcv" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="sklearn.model_selection.RandomizedSearchCV">
<em class="property">class </em><code class="sig-prename descclassname">sklearn.model_selection.</code><code class="sig-name descname">RandomizedSearchCV</code><span class="sig-paren">(</span><em class="sig-param">estimator</em>, <em class="sig-param">param_distributions</em>, <em class="sig-param">n_iter=10</em>, <em class="sig-param">scoring=None</em>, <em class="sig-param">n_jobs=None</em>, <em class="sig-param">iid='deprecated'</em>, <em class="sig-param">refit=True</em>, <em class="sig-param">cv=None</em>, <em class="sig-param">verbose=0</em>, <em class="sig-param">pre_dispatch='2*n_jobs'</em>, <em class="sig-param">random_state=None</em>, <em class="sig-param">error_score=nan</em>, <em class="sig-param">return_train_score=False</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/model_selection/_search.py#L1156"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV" title="Permalink to this definition">¶</a></dt>
<dd><p>Randomized search on hyper parameters.</p>
<p>RandomizedSearchCV implements a “fit” and a “score” method.
It also implements “predict”, “predict_proba”, “decision_function”,
“transform” and “inverse_transform” if they are implemented in the
estimator used.</p>
<p>The parameters of the estimator used to apply these methods are optimized
by cross-validated search over parameter settings.</p>
<p>In contrast to GridSearchCV, not all parameter values are tried out, but
rather a fixed number of parameter settings is sampled from the specified
distributions. The number of parameter settings that are tried is
given by n_iter.</p>
<p>If all parameters are presented as a list,
sampling without replacement is performed. If at least one parameter
is given as a distribution, sampling with replacement is used.
It is highly recommended to use continuous distributions for continuous
parameters.</p>
<p>Read more in the <a class="reference internal" href="../grid_search.html#randomized-parameter-search"><span class="std std-ref">User Guide</span></a>.</p>
<div class="versionadded">
<p><span class="versionmodified added">New in version 0.14.</span></p>
</div>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>estimator</strong><span class="classifier">estimator object.</span></dt><dd><p>A object of that type is instantiated for each grid point.
This is assumed to implement the scikit-learn estimator interface.
Either estimator needs to provide a <code class="docutils literal notranslate"><span class="pre">score</span></code> function,
or <code class="docutils literal notranslate"><span class="pre">scoring</span></code> must be passed.</p>
</dd>
<dt><strong>param_distributions</strong><span class="classifier">dict or list of dicts</span></dt><dd><p>Dictionary with parameters names (string) as keys and distributions
or lists of parameters to try. Distributions must provide a <code class="docutils literal notranslate"><span class="pre">rvs</span></code>
method for sampling (such as those from scipy.stats.distributions).
If a list is given, it is sampled uniformly.
If a list of dicts is given, first a dict is sampled uniformly, and
then a parameter is sampled using that dict as above.</p>
</dd>
<dt><strong>n_iter</strong><span class="classifier">int, default=10</span></dt><dd><p>Number of parameter settings that are sampled. n_iter trades
off runtime vs quality of the solution.</p>
</dd>
<dt><strong>scoring</strong><span class="classifier">string, callable, list/tuple, dict or None, default: None</span></dt><dd><p>A single string (see <a class="reference internal" href="../model_evaluation.html#scoring-parameter"><span class="std std-ref">The scoring parameter: defining model evaluation rules</span></a>) or a callable
(see <a class="reference internal" href="../model_evaluation.html#scoring"><span class="std std-ref">Defining your scoring strategy from metric functions</span></a>) to evaluate the predictions on the test set.</p>
<p>For evaluating multiple metrics, either give a list of (unique) strings
or a dict with names as keys and callables as values.</p>
<p>NOTE that when using custom scorers, each scorer should return a single
value. Metric functions returning a list/array of values can be wrapped
into multiple scorers that return one value each.</p>
<p>See <a class="reference internal" href="../grid_search.html#multimetric-grid-search"><span class="std std-ref">Specifying multiple metrics for evaluation</span></a> for an example.</p>
<p>If None, the estimator’s score method is used.</p>
</dd>
<dt><strong>n_jobs</strong><span class="classifier">int or None, optional (default=None)</span></dt><dd><p>Number of jobs to run in parallel.
<code class="docutils literal notranslate"><span class="pre">None</span></code> means 1 unless in a <a class="reference external" href="https://joblib.readthedocs.io/en/latest/parallel.html#joblib.parallel_backend" title="(in joblib v0.14.1.dev0)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">joblib.parallel_backend</span></code></a> context.
<code class="docutils literal notranslate"><span class="pre">-1</span></code> means using all processors. See <a class="reference internal" href="../../glossary.html#term-n-jobs"><span class="xref std std-term">Glossary</span></a>
for more details.</p>
</dd>
<dt><strong>pre_dispatch</strong><span class="classifier">int, or string, optional</span></dt><dd><p>Controls the number of jobs that get dispatched during parallel
execution. Reducing this number can be useful to avoid an
explosion of memory consumption when more jobs get dispatched
than CPUs can process. This parameter can be:</p>
<blockquote>
<div><ul class="simple">
<li><p>None, in which case all the jobs are immediately
created and spawned. Use this for lightweight and
fast-running jobs, to avoid delays due to on-demand
spawning of the jobs</p></li>
<li><p>An int, giving the exact number of total jobs that are
spawned</p></li>
<li><p>A string, giving an expression as a function of n_jobs,
as in ‘2*n_jobs’</p></li>
</ul>
</div></blockquote>
</dd>
<dt><strong>iid</strong><span class="classifier">boolean, default=False</span></dt><dd><p>If True, return the average score across folds, weighted by the number
of samples in each test set. In this case, the data is assumed to be
identically distributed across the folds, and the loss minimized is
the total loss per sample, and not the mean loss across the folds.</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 0.22: </span>Parameter <code class="docutils literal notranslate"><span class="pre">iid</span></code> is deprecated in 0.22 and will be removed in 0.24</p>
</div>
</dd>
<dt><strong>cv</strong><span class="classifier">int, cross-validation generator or an iterable, optional</span></dt><dd><p>Determines the cross-validation splitting strategy.
Possible inputs for cv are:</p>
<ul class="simple">
<li><p>None, to use the default 5-fold cross validation,</p></li>
<li><p>integer, to specify the number of folds in a <code class="docutils literal notranslate"><span class="pre">(Stratified)KFold</span></code>,</p></li>
<li><p><a class="reference internal" href="../../glossary.html#term-cv-splitter"><span class="xref std std-term">CV splitter</span></a>,</p></li>
<li><p>An iterable yielding (train, test) splits as arrays of indices.</p></li>
</ul>
<p>For integer/None inputs, if the estimator is a classifier and <code class="docutils literal notranslate"><span class="pre">y</span></code> is
either binary or multiclass, <a class="reference internal" href="sklearn.model_selection.StratifiedKFold.html#sklearn.model_selection.StratifiedKFold" title="sklearn.model_selection.StratifiedKFold"><code class="xref py py-class docutils literal notranslate"><span class="pre">StratifiedKFold</span></code></a> is used. In all
other cases, <a class="reference internal" href="sklearn.model_selection.KFold.html#sklearn.model_selection.KFold" title="sklearn.model_selection.KFold"><code class="xref py py-class docutils literal notranslate"><span class="pre">KFold</span></code></a> is used.</p>
<p>Refer <a class="reference internal" href="../cross_validation.html#cross-validation"><span class="std std-ref">User Guide</span></a> for the various
cross-validation strategies that can be used here.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 0.22: </span><code class="docutils literal notranslate"><span class="pre">cv</span></code> default value if None changed from 3-fold to 5-fold.</p>
</div>
</dd>
<dt><strong>refit</strong><span class="classifier">boolean, string, or callable, default=True</span></dt><dd><p>Refit an estimator using the best found parameters on the whole
dataset.</p>
<p>For multiple metric evaluation, this needs to be a string denoting the
scorer that would be used to find the best parameters for refitting
the estimator at the end.</p>
<p>Where there are considerations other than maximum score in
choosing a best estimator, <code class="docutils literal notranslate"><span class="pre">refit</span></code> can be set to a function which
returns the selected <code class="docutils literal notranslate"><span class="pre">best_index_</span></code> given the <code class="docutils literal notranslate"><span class="pre">cv_results</span></code>. In that
case, the <code class="docutils literal notranslate"><span class="pre">best_estimator_</span></code> and <code class="docutils literal notranslate"><span class="pre">best_parameters_</span></code> will be set
according to the returned <code class="docutils literal notranslate"><span class="pre">best_index_</span></code> while the <code class="docutils literal notranslate"><span class="pre">best_score_</span></code>
attribute will not be available.</p>
<p>The refitted estimator is made available at the <code class="docutils literal notranslate"><span class="pre">best_estimator_</span></code>
attribute and permits using <code class="docutils literal notranslate"><span class="pre">predict</span></code> directly on this
<code class="docutils literal notranslate"><span class="pre">RandomizedSearchCV</span></code> instance.</p>
<p>Also for multiple metric evaluation, the attributes <code class="docutils literal notranslate"><span class="pre">best_index_</span></code>,
<code class="docutils literal notranslate"><span class="pre">best_score_</span></code> and <code class="docutils literal notranslate"><span class="pre">best_params_</span></code> will only be available if
<code class="docutils literal notranslate"><span class="pre">refit</span></code> is set and all of them will be determined w.r.t this specific
scorer.</p>
<p>See <code class="docutils literal notranslate"><span class="pre">scoring</span></code> parameter to know more about multiple metric
evaluation.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 0.20: </span>Support for callable added.</p>
</div>
</dd>
<dt><strong>verbose</strong><span class="classifier">integer</span></dt><dd><p>Controls the verbosity: the higher, the more messages.</p>
</dd>
<dt><strong>random_state</strong><span class="classifier">int, RandomState instance or None, optional, default=None</span></dt><dd><p>Pseudo random number generator state used for random uniform sampling
from lists of possible values instead of scipy.stats distributions.
If int, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used
by <code class="docutils literal notranslate"><span class="pre">np.random</span></code>.</p>
</dd>
<dt><strong>error_score</strong><span class="classifier">‘raise’ or numeric</span></dt><dd><p>Value to assign to the score if an error occurs in estimator fitting.
If set to ‘raise’, the error is raised. If a numeric value is given,
FitFailedWarning is raised. This parameter does not affect the refit
step, which will always raise the error. Default is <code class="docutils literal notranslate"><span class="pre">np.nan</span></code>.</p>
</dd>
<dt><strong>return_train_score</strong><span class="classifier">boolean, default=False</span></dt><dd><p>If <code class="docutils literal notranslate"><span class="pre">False</span></code>, the <code class="docutils literal notranslate"><span class="pre">cv_results_</span></code> attribute will not include training
scores.
Computing training scores is used to get insights on how different
parameter settings impact the overfitting/underfitting trade-off.
However computing the scores on the training set can be computationally
expensive and is not strictly required to select the parameters that
yield the best generalization performance.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Attributes</dt>
<dd class="field-even"><dl>
<dt><strong>cv_results_</strong><span class="classifier">dict of numpy (masked) ndarrays</span></dt><dd><p>A dict with keys as column headers and values as columns, that can be
imported into a pandas <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>.</p>
<p>For instance the below given table</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 22%" />
<col style="width: 20%" />
<col style="width: 30%" />
<col style="width: 5%" />
<col style="width: 23%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>param_kernel</p></th>
<th class="head"><p>param_gamma</p></th>
<th class="head"><p>split0_test_score</p></th>
<th class="head"><p>…</p></th>
<th class="head"><p>rank_test_score</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>‘rbf’</p></td>
<td><p>0.1</p></td>
<td><p>0.80</p></td>
<td><p>…</p></td>
<td><p>2</p></td>
</tr>
<tr class="row-odd"><td><p>‘rbf’</p></td>
<td><p>0.2</p></td>
<td><p>0.90</p></td>
<td><p>…</p></td>
<td><p>1</p></td>
</tr>
<tr class="row-even"><td><p>‘rbf’</p></td>
<td><p>0.3</p></td>
<td><p>0.70</p></td>
<td><p>…</p></td>
<td><p>1</p></td>
</tr>
</tbody>
</table>
<p>will be represented by a <code class="docutils literal notranslate"><span class="pre">cv_results_</span></code> dict of:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s1">&#39;param_kernel&#39;</span> <span class="p">:</span> <span class="n">masked_array</span><span class="p">(</span><span class="n">data</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;rbf&#39;</span><span class="p">,</span> <span class="s1">&#39;rbf&#39;</span><span class="p">,</span> <span class="s1">&#39;rbf&#39;</span><span class="p">],</span>
                              <span class="n">mask</span> <span class="o">=</span> <span class="kc">False</span><span class="p">),</span>
<span class="s1">&#39;param_gamma&#39;</span>  <span class="p">:</span> <span class="n">masked_array</span><span class="p">(</span><span class="n">data</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.1</span> <span class="mf">0.2</span> <span class="mf">0.3</span><span class="p">],</span> <span class="n">mask</span> <span class="o">=</span> <span class="kc">False</span><span class="p">),</span>
<span class="s1">&#39;split0_test_score&#39;</span>  <span class="p">:</span> <span class="p">[</span><span class="mf">0.80</span><span class="p">,</span> <span class="mf">0.90</span><span class="p">,</span> <span class="mf">0.70</span><span class="p">],</span>
<span class="s1">&#39;split1_test_score&#39;</span>  <span class="p">:</span> <span class="p">[</span><span class="mf">0.82</span><span class="p">,</span> <span class="mf">0.50</span><span class="p">,</span> <span class="mf">0.70</span><span class="p">],</span>
<span class="s1">&#39;mean_test_score&#39;</span>    <span class="p">:</span> <span class="p">[</span><span class="mf">0.81</span><span class="p">,</span> <span class="mf">0.70</span><span class="p">,</span> <span class="mf">0.70</span><span class="p">],</span>
<span class="s1">&#39;std_test_score&#39;</span>     <span class="p">:</span> <span class="p">[</span><span class="mf">0.01</span><span class="p">,</span> <span class="mf">0.20</span><span class="p">,</span> <span class="mf">0.00</span><span class="p">],</span>
<span class="s1">&#39;rank_test_score&#39;</span>    <span class="p">:</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span>
<span class="s1">&#39;split0_train_score&#39;</span> <span class="p">:</span> <span class="p">[</span><span class="mf">0.80</span><span class="p">,</span> <span class="mf">0.92</span><span class="p">,</span> <span class="mf">0.70</span><span class="p">],</span>
<span class="s1">&#39;split1_train_score&#39;</span> <span class="p">:</span> <span class="p">[</span><span class="mf">0.82</span><span class="p">,</span> <span class="mf">0.55</span><span class="p">,</span> <span class="mf">0.70</span><span class="p">],</span>
<span class="s1">&#39;mean_train_score&#39;</span>   <span class="p">:</span> <span class="p">[</span><span class="mf">0.81</span><span class="p">,</span> <span class="mf">0.74</span><span class="p">,</span> <span class="mf">0.70</span><span class="p">],</span>
<span class="s1">&#39;std_train_score&#39;</span>    <span class="p">:</span> <span class="p">[</span><span class="mf">0.01</span><span class="p">,</span> <span class="mf">0.19</span><span class="p">,</span> <span class="mf">0.00</span><span class="p">],</span>
<span class="s1">&#39;mean_fit_time&#39;</span>      <span class="p">:</span> <span class="p">[</span><span class="mf">0.73</span><span class="p">,</span> <span class="mf">0.63</span><span class="p">,</span> <span class="mf">0.43</span><span class="p">],</span>
<span class="s1">&#39;std_fit_time&#39;</span>       <span class="p">:</span> <span class="p">[</span><span class="mf">0.01</span><span class="p">,</span> <span class="mf">0.02</span><span class="p">,</span> <span class="mf">0.01</span><span class="p">],</span>
<span class="s1">&#39;mean_score_time&#39;</span>    <span class="p">:</span> <span class="p">[</span><span class="mf">0.01</span><span class="p">,</span> <span class="mf">0.06</span><span class="p">,</span> <span class="mf">0.04</span><span class="p">],</span>
<span class="s1">&#39;std_score_time&#39;</span>     <span class="p">:</span> <span class="p">[</span><span class="mf">0.00</span><span class="p">,</span> <span class="mf">0.00</span><span class="p">,</span> <span class="mf">0.00</span><span class="p">],</span>
<span class="s1">&#39;params&#39;</span>             <span class="p">:</span> <span class="p">[{</span><span class="s1">&#39;kernel&#39;</span> <span class="p">:</span> <span class="s1">&#39;rbf&#39;</span><span class="p">,</span> <span class="s1">&#39;gamma&#39;</span> <span class="p">:</span> <span class="mf">0.1</span><span class="p">},</span> <span class="o">...</span><span class="p">],</span>
<span class="p">}</span>
</pre></div>
</div>
<p>NOTE</p>
<p>The key <code class="docutils literal notranslate"><span class="pre">'params'</span></code> is used to store a list of parameter
settings dicts for all the parameter candidates.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">mean_fit_time</span></code>, <code class="docutils literal notranslate"><span class="pre">std_fit_time</span></code>, <code class="docutils literal notranslate"><span class="pre">mean_score_time</span></code> and
<code class="docutils literal notranslate"><span class="pre">std_score_time</span></code> are all in seconds.</p>
<p>For multi-metric evaluation, the scores for all the scorers are
available in the <code class="docutils literal notranslate"><span class="pre">cv_results_</span></code> dict at the keys ending with that
scorer’s name (<code class="docutils literal notranslate"><span class="pre">'_&lt;scorer_name&gt;'</span></code>) instead of <code class="docutils literal notranslate"><span class="pre">'_score'</span></code> shown
above. (‘split0_test_precision’, ‘mean_train_precision’ etc.)</p>
</dd>
<dt><strong>best_estimator_</strong><span class="classifier">estimator</span></dt><dd><p>Estimator that was chosen by the search, i.e. estimator
which gave highest score (or smallest loss if specified)
on the left out data. Not available if <code class="docutils literal notranslate"><span class="pre">refit=False</span></code>.</p>
<p>For multi-metric evaluation, this attribute is present only if
<code class="docutils literal notranslate"><span class="pre">refit</span></code> is specified.</p>
<p>See <code class="docutils literal notranslate"><span class="pre">refit</span></code> parameter for more information on allowed values.</p>
</dd>
<dt><strong>best_score_</strong><span class="classifier">float</span></dt><dd><p>Mean cross-validated score of the best_estimator.</p>
<p>For multi-metric evaluation, this is not available if <code class="docutils literal notranslate"><span class="pre">refit</span></code> is
<code class="docutils literal notranslate"><span class="pre">False</span></code>. See <code class="docutils literal notranslate"><span class="pre">refit</span></code> parameter for more information.</p>
<p>This attribute is not available if <code class="docutils literal notranslate"><span class="pre">refit</span></code> is a function.</p>
</dd>
<dt><strong>best_params_</strong><span class="classifier">dict</span></dt><dd><p>Parameter setting that gave the best results on the hold out data.</p>
<p>For multi-metric evaluation, this is not available if <code class="docutils literal notranslate"><span class="pre">refit</span></code> is
<code class="docutils literal notranslate"><span class="pre">False</span></code>. See <code class="docutils literal notranslate"><span class="pre">refit</span></code> parameter for more information.</p>
</dd>
<dt><strong>best_index_</strong><span class="classifier">int</span></dt><dd><p>The index (of the <code class="docutils literal notranslate"><span class="pre">cv_results_</span></code> arrays) which corresponds to the best
candidate parameter setting.</p>
<p>The dict at <code class="docutils literal notranslate"><span class="pre">search.cv_results_['params'][search.best_index_]</span></code> gives
the parameter setting for the best model, that gives the highest
mean score (<code class="docutils literal notranslate"><span class="pre">search.best_score_</span></code>).</p>
<p>For multi-metric evaluation, this is not available if <code class="docutils literal notranslate"><span class="pre">refit</span></code> is
<code class="docutils literal notranslate"><span class="pre">False</span></code>. See <code class="docutils literal notranslate"><span class="pre">refit</span></code> parameter for more information.</p>
</dd>
<dt><strong>scorer_</strong><span class="classifier">function or a dict</span></dt><dd><p>Scorer function used on the held out data to choose the best
parameters for the model.</p>
<p>For multi-metric evaluation, this attribute holds the validated
<code class="docutils literal notranslate"><span class="pre">scoring</span></code> dict which maps the scorer key to the scorer callable.</p>
</dd>
<dt><strong>n_splits_</strong><span class="classifier">int</span></dt><dd><p>The number of cross-validation splits (folds/iterations).</p>
</dd>
<dt><strong>refit_time_</strong><span class="classifier">float</span></dt><dd><p>Seconds used for refitting the best model on the whole dataset.</p>
<p>This is present only if <code class="docutils literal notranslate"><span class="pre">refit</span></code> is not False.</p>
</dd>
</dl>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV" title="sklearn.model_selection.GridSearchCV"><code class="xref py py-class docutils literal notranslate"><span class="pre">GridSearchCV</span></code></a></dt><dd><p>Does exhaustive search over a grid of parameters.</p>
</dd>
<dt><a class="reference internal" href="sklearn.model_selection.ParameterSampler.html#sklearn.model_selection.ParameterSampler" title="sklearn.model_selection.ParameterSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">ParameterSampler</span></code></a></dt><dd><p>A generator over parameter settings, constructed from param_distributions.</p>
</dd>
</dl>
</div>
<p class="rubric">Notes</p>
<p>The parameters selected are those that maximize the score of the held-out
data, according to the scoring parameter.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">n_jobs</span></code> was set to a value higher than one, the data is copied for each
parameter setting(and not <code class="docutils literal notranslate"><span class="pre">n_jobs</span></code> times). This is done for efficiency
reasons if individual jobs take very little time, but may raise errors if
the dataset is large and not enough memory is available.  A workaround in
this case is to set <code class="docutils literal notranslate"><span class="pre">pre_dispatch</span></code>. Then, the memory is copied only
<code class="docutils literal notranslate"><span class="pre">pre_dispatch</span></code> many times. A reasonable value for <code class="docutils literal notranslate"><span class="pre">pre_dispatch</span></code> is <code class="docutils literal notranslate"><span class="pre">2</span> <span class="pre">*</span>
<span class="pre">n_jobs</span></code>.</p>
<p class="rubric">Examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.datasets</span> <span class="kn">import</span> <span class="n">load_iris</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.linear_model</span> <span class="kn">import</span> <span class="n">LogisticRegression</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.model_selection</span> <span class="kn">import</span> <span class="n">RandomizedSearchCV</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">scipy.stats</span> <span class="kn">import</span> <span class="n">uniform</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">iris</span> <span class="o">=</span> <span class="n">load_iris</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">logistic</span> <span class="o">=</span> <span class="n">LogisticRegression</span><span class="p">(</span><span class="n">solver</span><span class="o">=</span><span class="s1">&#39;saga&#39;</span><span class="p">,</span> <span class="n">tol</span><span class="o">=</span><span class="mf">1e-2</span><span class="p">,</span> <span class="n">max_iter</span><span class="o">=</span><span class="mi">200</span><span class="p">,</span>
<span class="gp">... </span>                              <span class="n">random_state</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">distributions</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">C</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mi">4</span><span class="p">),</span>
<span class="gp">... </span>                     <span class="n">penalty</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;l2&#39;</span><span class="p">,</span> <span class="s1">&#39;l1&#39;</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">clf</span> <span class="o">=</span> <span class="n">RandomizedSearchCV</span><span class="p">(</span><span class="n">logistic</span><span class="p">,</span> <span class="n">distributions</span><span class="p">,</span> <span class="n">random_state</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">search</span> <span class="o">=</span> <span class="n">clf</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">iris</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="n">iris</span><span class="o">.</span><span class="n">target</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">search</span><span class="o">.</span><span class="n">best_params_</span>
<span class="go">{&#39;C&#39;: 2..., &#39;penalty&#39;: &#39;l1&#39;}</span>
</pre></div>
</div>
<p class="rubric">Methods</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.model_selection.RandomizedSearchCV.decision_function" title="sklearn.model_selection.RandomizedSearchCV.decision_function"><code class="xref py py-obj docutils literal notranslate"><span class="pre">decision_function</span></code></a>(self, X)</p></td>
<td><p>Call decision_function on the estimator with the best found parameters.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.model_selection.RandomizedSearchCV.fit" title="sklearn.model_selection.RandomizedSearchCV.fit"><code class="xref py py-obj docutils literal notranslate"><span class="pre">fit</span></code></a>(self, X[, y, groups])</p></td>
<td><p>Run fit with all sets of parameters.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.model_selection.RandomizedSearchCV.get_params" title="sklearn.model_selection.RandomizedSearchCV.get_params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_params</span></code></a>(self[, deep])</p></td>
<td><p>Get parameters for this estimator.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.model_selection.RandomizedSearchCV.inverse_transform" title="sklearn.model_selection.RandomizedSearchCV.inverse_transform"><code class="xref py py-obj docutils literal notranslate"><span class="pre">inverse_transform</span></code></a>(self, Xt)</p></td>
<td><p>Call inverse_transform on the estimator with the best found params.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.model_selection.RandomizedSearchCV.predict" title="sklearn.model_selection.RandomizedSearchCV.predict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">predict</span></code></a>(self, X)</p></td>
<td><p>Call predict on the estimator with the best found parameters.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.model_selection.RandomizedSearchCV.predict_log_proba" title="sklearn.model_selection.RandomizedSearchCV.predict_log_proba"><code class="xref py py-obj docutils literal notranslate"><span class="pre">predict_log_proba</span></code></a>(self, X)</p></td>
<td><p>Call predict_log_proba on the estimator with the best found parameters.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.model_selection.RandomizedSearchCV.predict_proba" title="sklearn.model_selection.RandomizedSearchCV.predict_proba"><code class="xref py py-obj docutils literal notranslate"><span class="pre">predict_proba</span></code></a>(self, X)</p></td>
<td><p>Call predict_proba on the estimator with the best found parameters.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.model_selection.RandomizedSearchCV.score" title="sklearn.model_selection.RandomizedSearchCV.score"><code class="xref py py-obj docutils literal notranslate"><span class="pre">score</span></code></a>(self, X[, y])</p></td>
<td><p>Returns the score on the given data, if the estimator has been refit.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.model_selection.RandomizedSearchCV.set_params" title="sklearn.model_selection.RandomizedSearchCV.set_params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_params</span></code></a>(self, \*\*params)</p></td>
<td><p>Set the parameters of this estimator.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.model_selection.RandomizedSearchCV.transform" title="sklearn.model_selection.RandomizedSearchCV.transform"><code class="xref py py-obj docutils literal notranslate"><span class="pre">transform</span></code></a>(self, X)</p></td>
<td><p>Call transform on the estimator with the best found parameters.</p></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">estimator</em>, <em class="sig-param">param_distributions</em>, <em class="sig-param">n_iter=10</em>, <em class="sig-param">scoring=None</em>, <em class="sig-param">n_jobs=None</em>, <em class="sig-param">iid='deprecated'</em>, <em class="sig-param">refit=True</em>, <em class="sig-param">cv=None</em>, <em class="sig-param">verbose=0</em>, <em class="sig-param">pre_dispatch='2*n_jobs'</em>, <em class="sig-param">random_state=None</em>, <em class="sig-param">error_score=nan</em>, <em class="sig-param">return_train_score=False</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/model_selection/_search.py#L1468"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
</dd></dl>

<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.decision_function">
<code class="sig-name descname">decision_function</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L513"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.decision_function" title="Permalink to this definition">¶</a></dt>
<dd><p>Call decision_function on the estimator with the best found parameters.</p>
<p>Only available if <code class="docutils literal notranslate"><span class="pre">refit=True</span></code> and the underlying estimator supports
<code class="docutils literal notranslate"><span class="pre">decision_function</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">indexable, length n_samples</span></dt><dd><p>Must fulfill the input assumptions of the
underlying estimator.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.fit">
<code class="sig-name descname">fit</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">y=None</em>, <em class="sig-param">groups=None</em>, <em class="sig-param">**fit_params</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/model_selection/_search.py#L603"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>Run fit with all sets of parameters.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">array-like of shape (n_samples, n_features)</span></dt><dd><p>Training vector, where n_samples is the number of samples and
n_features is the number of features.</p>
</dd>
<dt><strong>y</strong><span class="classifier">array-like of shape (n_samples, n_output) or (n_samples,), optional</span></dt><dd><p>Target relative to X for classification or regression;
None for unsupervised learning.</p>
</dd>
<dt><strong>groups</strong><span class="classifier">array-like, with shape (n_samples,), optional</span></dt><dd><p>Group labels for the samples used while splitting the dataset into
train/test set. Only used in conjunction with a “Group” <a class="reference internal" href="../../glossary.html#term-cv"><span class="xref std std-term">cv</span></a>
instance (e.g., <a class="reference internal" href="sklearn.model_selection.GroupKFold.html#sklearn.model_selection.GroupKFold" title="sklearn.model_selection.GroupKFold"><code class="xref py py-class docutils literal notranslate"><span class="pre">GroupKFold</span></code></a>).</p>
</dd>
<dt><strong>**fit_params</strong><span class="classifier">dict of string -&gt; object</span></dt><dd><p>Parameters passed to the <code class="docutils literal notranslate"><span class="pre">fit</span></code> method of the estimator</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.get_params">
<code class="sig-name descname">get_params</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">deep=True</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/base.py#L173"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.get_params" title="Permalink to this definition">¶</a></dt>
<dd><p>Get parameters for this estimator.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>deep</strong><span class="classifier">bool, default=True</span></dt><dd><p>If True, will return the parameters for this estimator and
contained subobjects that are estimators.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>params</strong><span class="classifier">mapping of string to any</span></dt><dd><p>Parameter names mapped to their values.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.inverse_transform">
<code class="sig-name descname">inverse_transform</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">Xt</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L547"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.inverse_transform" title="Permalink to this definition">¶</a></dt>
<dd><p>Call inverse_transform on the estimator with the best found params.</p>
<p>Only available if the underlying estimator implements
<code class="docutils literal notranslate"><span class="pre">inverse_transform</span></code> and <code class="docutils literal notranslate"><span class="pre">refit=True</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>Xt</strong><span class="classifier">indexable, length n_samples</span></dt><dd><p>Must fulfill the input assumptions of the
underlying estimator.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.predict">
<code class="sig-name descname">predict</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L462"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>Call predict on the estimator with the best found parameters.</p>
<p>Only available if <code class="docutils literal notranslate"><span class="pre">refit=True</span></code> and the underlying estimator supports
<code class="docutils literal notranslate"><span class="pre">predict</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">indexable, length n_samples</span></dt><dd><p>Must fulfill the input assumptions of the
underlying estimator.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.predict_log_proba">
<code class="sig-name descname">predict_log_proba</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L496"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.predict_log_proba" title="Permalink to this definition">¶</a></dt>
<dd><p>Call predict_log_proba on the estimator with the best found parameters.</p>
<p>Only available if <code class="docutils literal notranslate"><span class="pre">refit=True</span></code> and the underlying estimator supports
<code class="docutils literal notranslate"><span class="pre">predict_log_proba</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">indexable, length n_samples</span></dt><dd><p>Must fulfill the input assumptions of the
underlying estimator.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.predict_proba">
<code class="sig-name descname">predict_proba</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L479"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.predict_proba" title="Permalink to this definition">¶</a></dt>
<dd><p>Call predict_proba on the estimator with the best found parameters.</p>
<p>Only available if <code class="docutils literal notranslate"><span class="pre">refit=True</span></code> and the underlying estimator supports
<code class="docutils literal notranslate"><span class="pre">predict_proba</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">indexable, length n_samples</span></dt><dd><p>Must fulfill the input assumptions of the
underlying estimator.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.score">
<code class="sig-name descname">score</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">y=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/model_selection/_search.py#L422"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.score" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the score on the given data, if the estimator has been refit.</p>
<p>This uses the score defined by <code class="docutils literal notranslate"><span class="pre">scoring</span></code> where provided, and the
<code class="docutils literal notranslate"><span class="pre">best_estimator_.score</span></code> method otherwise.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">array-like of shape (n_samples, n_features)</span></dt><dd><p>Input data, where n_samples is the number of samples and
n_features is the number of features.</p>
</dd>
<dt><strong>y</strong><span class="classifier">array-like of shape (n_samples, n_output) or (n_samples,), optional</span></dt><dd><p>Target relative to X for classification or regression;
None for unsupervised learning.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>score</strong><span class="classifier">float</span></dt><dd></dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.set_params">
<code class="sig-name descname">set_params</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">**params</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/base.py#L205"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.set_params" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the parameters of this estimator.</p>
<p>The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<code class="docutils literal notranslate"><span class="pre">&lt;component&gt;__&lt;parameter&gt;</span></code> so that it’s possible to update each
component of a nested object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>**params</strong><span class="classifier">dict</span></dt><dd><p>Estimator parameters.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>self</strong><span class="classifier">object</span></dt><dd><p>Estimator instance.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.model_selection.RandomizedSearchCV.transform">
<code class="sig-name descname">transform</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/utils/metaestimators.py#L530"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.model_selection.RandomizedSearchCV.transform" title="Permalink to this definition">¶</a></dt>
<dd><p>Call transform on the estimator with the best found parameters.</p>
<p>Only available if the underlying estimator supports <code class="docutils literal notranslate"><span class="pre">transform</span></code> and
<code class="docutils literal notranslate"><span class="pre">refit=True</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">indexable, length n_samples</span></dt><dd><p>Must fulfill the input assumptions of the
underlying estimator.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

</dd></dl>

<div class="section" id="examples-using-sklearn-model-selection-randomizedsearchcv">
<h2>Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.model_selection.RandomizedSearchCV</span></code><a class="headerlink" href="#examples-using-sklearn-model-selection-randomizedsearchcv" title="Permalink to this headline">¶</a></h2>
<div class="sphx-glr-thumbcontainer" tooltip="Compare randomized search and grid search for optimizing hyperparameters of a random forest. Al..."><div class="figure align-default" id="id1">
<img alt="../../_images/sphx_glr_plot_randomized_search_thumb.png" src="../../_images/sphx_glr_plot_randomized_search_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/plot_randomized_search.html#sphx-glr-auto-examples-model-selection-plot-randomized-search-py"><span class="std std-ref">Comparing randomized search and grid search for hyperparameter estimation</span></a></span><a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>
</div>
</div><div class="clearer"></div></div>
</div>


      </div>
    <div class="container">
      <footer class="sk-content-footer">
            &copy; 2007 - 2019, scikit-learn developers (BSD License).
          <a href="../../_sources/modules/generated/sklearn.model_selection.RandomizedSearchCV.rst.txt" rel="nofollow">Show this page source</a>
      </footer>
    </div>
  </div>
</div>
<script src="../../_static/js/vendor/bootstrap.min.js"></script>

<script>
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', 'UA-22606712-2', 'auto');
    ga('set', 'anonymizeIp', true);
    ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>


<script>
$(document).ready(function() {
    /* Add a [>>>] button on the top-right corner of code samples to hide
     * the >>> and ... prompts and the output and thus make the code
     * copyable. */
    var div = $('.highlight-python .highlight,' +
                '.highlight-python3 .highlight,' +
                '.highlight-pycon .highlight,' +
		'.highlight-default .highlight')
    var pre = div.find('pre');

    // get the styles from the current theme
    pre.parent().parent().css('position', 'relative');
    var hide_text = 'Hide prompts and outputs';
    var show_text = 'Show prompts and outputs';

    // create and add the button to all the code blocks that contain >>>
    div.each(function(index) {
        var jthis = $(this);
        if (jthis.find('.gp').length > 0) {
            var button = $('<span class="copybutton">&gt;&gt;&gt;</span>');
            button.attr('title', hide_text);
            button.data('hidden', 'false');
            jthis.prepend(button);
        }
        // tracebacks (.gt) contain bare text elements that need to be
        // wrapped in a span to work with .nextUntil() (see later)
        jthis.find('pre:has(.gt)').contents().filter(function() {
            return ((this.nodeType == 3) && (this.data.trim().length > 0));
        }).wrap('<span>');
    });

    // define the behavior of the button when it's clicked
    $('.copybutton').click(function(e){
        e.preventDefault();
        var button = $(this);
        if (button.data('hidden') === 'false') {
            // hide the code output
            button.parent().find('.go, .gp, .gt').hide();
            button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden');
            button.css('text-decoration', 'line-through');
            button.attr('title', show_text);
            button.data('hidden', 'true');
        } else {
            // show the code output
            button.parent().find('.go, .gp, .gt').show();
            button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible');
            button.css('text-decoration', 'none');
            button.attr('title', hide_text);
            button.data('hidden', 'false');
        }
    });

	/*** Add permalink buttons next to glossary terms ***/
	$('dl.glossary > dt[id]').append(function() {
		return ('<a class="headerlink" href="#' +
			    this.getAttribute('id') +
			    '" title="Permalink to this term">¶</a>');
	});
  /*** Hide navbar when scrolling down ***/
  // Returns true when headerlink target matches hash in url
  (function() {
    hashTargetOnTop = function() {
        var hash = window.location.hash;
        if ( hash.length < 2 ) { return false; }

        var target = document.getElementById( hash.slice(1) );
        if ( target === null ) { return false; }

        var top = target.getBoundingClientRect().top;
        return (top < 2) && (top > -2);
    };

    // Hide navbar on load if hash target is on top
    var navBar = document.getElementById("navbar");
    var navBarToggler = document.getElementById("sk-navbar-toggler");
    var navBarHeightHidden = "-" + navBar.getBoundingClientRect().height + "px";
    var $window = $(window);

    hideNavBar = function() {
        navBar.style.top = navBarHeightHidden;
    };

    showNavBar = function() {
        navBar.style.top = "0";
    }

    if (hashTargetOnTop()) {
        hideNavBar()
    }

    var prevScrollpos = window.pageYOffset;
    hideOnScroll = function(lastScrollTop) {
        if (($window.width() < 768) && (navBarToggler.getAttribute("aria-expanded") === 'true')) {
            return;
        }
        if (lastScrollTop > 2 && (prevScrollpos <= lastScrollTop) || hashTargetOnTop()){
            hideNavBar()
        } else {
            showNavBar()
        }
        prevScrollpos = lastScrollTop;
    };

    /*** high preformance scroll event listener***/
    var raf = window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        window.oRequestAnimationFrame;
    var lastScrollTop = $window.scrollTop();

    if (raf) {
        loop();
    }

    function loop() {
        var scrollTop = $window.scrollTop();
        if (lastScrollTop === scrollTop) {
            raf(loop);
            return;
        } else {
            lastScrollTop = scrollTop;
            hideOnScroll(lastScrollTop);
            raf(loop);
        }
    }
  })();
});

</script>
    
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
    
</body>
</html>